package com.free.bsf.metric.base;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.free.bsf.metric.controller.ScriptDownLoadFilter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;


@Configuration
public class ApplicationConfiguration {
    @Bean(name = "mysql")
    @ConfigurationProperties(prefix = "spring.datasource.druid.mysql")
    public DataSource mysqlDataSource() {
        return DruidDataSourceBuilder.create().build();
    }

    @Bean(name = "starrocks")
    @ConfigurationProperties(prefix = "spring.datasource.druid.starrocks")
    public DataSource starrocksDataSource() {
        return DruidDataSourceBuilder.create().build();
    }

    @Bean
    public ScriptDownLoadFilter scriptDownLoadFilter() {
        return new ScriptDownLoadFilter();
    }
}
